#ifndef __SESSION_HPP
#define __SESSION_HPP

#include "util.hpp"

typedef enum
{
    UNLOGIN,
    LOGIN
}ss_statu;//用户状态

class session
{
public:
    session(uint64_t ssid):_ssid(ssid)
    {
        DLOG("session %p 创建成功！！",this);
    }

    ~session()
    {
        DLOG("session %p 即将销毁！！", this);
    }

    void set_user(uint64_t uid)
    { 
        _uid = uid; 
    }

    uint64_t get_user() 
    { 
        return _uid; 
    }

    bool is_login()
    { 
        return (_statu == LOGIN); 
    }

    void set_timer(const wsserver_t::timer_ptr &tp)
    { 
        _tp = tp; 
    }

    wsserver_t::timer_ptr& get_timer()
    { 
        return _tp; 
    }
    
private:
    uint64_t _ssid;//标识符
    uint64_t _uid;//session对应的用户id
    ss_statu _statu;//用户状态
    wsserver_t::timer_ptr _tp;//session关联的定时器
};


#endif
